doseresNMA antidep/data.addclass.R

# add the class of each agent as factor (class) and as numeric (classF)
data_with_class <- function(data=antidep){
  data$class <-as.factor(with(data, ifelse(
    drug=='desvenlafaxine' | drug=='venlafaxine' | drug=='duloxetine'  | drug=='milnacipran' | drug=='levomilnacipran', 'SNRI', ifelse(
      drug=='bupropion' , 'NDRI', ifelse(
        drug=='mirtazapine', 'NaSSA', ifelse(
          drug=='trazodone'|drug=='nefazodone', 'SARI', ifelse(
            drug=='reboxetine', 'NRI',ifelse(
              drug=='placebo', 'placebo',ifelse(
                drug=='citalopram' | drug=='fluvoxamine' | drug=='escitalopram'  | drug=='paroxetine' | drug=='sertraline' | drug=='fluoxetine'| drug=='vilazodone', 'SSRI',ifelse(
                  drug=='amitriptyline'| drug=='clomipramine', 'TCA',ifelse(
                    drug=='agomelatine', 'agomelatine', 'vortioxetine'
                  )
                )

              )))))))))
  data$classF <- as.numeric(data$class)
  return(data)
}
#
htx-r/doseresNMA documentation built on Jan. 28, 2021, 5:32 a.m.